﻿
namespace HSS.Xaml.UI.Data
{
	#region Using Directives
	using System;
	using System.Windows;
	using System.Windows.Data;
	#endregion

	#region NotNullVisibleValueConverter
	/// <summary>
	/// Converts a non-NULL value to <see cref="Visibility.Visible"/> and a NULL value to <see cref="Visibility.Collapsed"/>.
	/// </summary>
	public class NotNullVisibleValueConverter : IValueConverter
	{
		/// <summary>
		/// Converts a non-NULL value to <see cref="Visibility.Visible"/> and a NULL value to <see cref="Visibility.Collapsed"/>.
		/// </summary>
		/// <param name="value">The value to convert.</param>
		/// <param name="targetType">Not used.</param>
		/// <param name="parameter">Not used.</param>
		/// <param name="culture">Not used.</param>
		/// <returns><see cref="Visibility.Visible"/> if the value is not NULL; otherwise <see cref="Visibility.Collapsed"/>.</returns>
		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (null != value)
				return Visibility.Visible;
			else
				return Visibility.Collapsed;
		}
		/// <summary>
		/// Simply returns <see cref="Visibility.Collapsed"/>.
		/// </summary>
		/// <param name="value">Not used.</param>
		/// <param name="targetType">Not used.</param>
		/// <param name="parameter">Not used.</param>
		/// <param name="culture">Not used.</param>
		/// <returns><see cref="Visibility.Collapsed"/></returns>
		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			return Visibility.Collapsed;
		}
	}
	#endregion
}